package com.sunfeng.n2;

import com.sunfeng.TimeUtils;
import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.Callable;

/**
 * 异步任务  是用Callable  不能创建线程
 *
 * @author sunfeng
 * @date 2021/03/15 14:10
 **/
@Slf4j(topic = "c.CallableTask")
public class CallableTask implements Callable<String> {
    @Override
    public String call() throws Exception {

        log.info("开始执行异步操作");
        TimeUtils.sleep(2);
        return "我是执行获取的结果";
    }
}
